package frankenstein.datastructures;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;



public class ParentModel implements Serializable {
	
	private Set<IViewUpdater> listeners = new HashSet<IViewUpdater>();
	
	// remove listener
	public void removeListener(IViewUpdater provider) {
		listeners.remove(provider);
	}

	//add listener
	public void addListener(IViewUpdater provider) {
		listeners.add(provider);
	}

	//update the view
	public void updateView() {
		Iterator<IViewUpdater> iterator = listeners.iterator();
		while (iterator.hasNext())
			iterator.next().updateThisView();
	}
}
